/**************************************************************************
 * $RCSfile: JMSServiceBridgeServlet.java,v $  $Revision: 1.1 $  $Date: 2009/08/20 08:07:52 $
 *
 * $Log: JMSServiceBridgeServlet.java,v $
 * Revision 1.1  2009/08/20 08:07:52  fengbin
 * JMSServiceBridge
 *
 * Revision 1.12  2009/06/22 10:39:53  fengbin
 * *** empty log message ***
 *
 **************************************************************************/
package com.simplefan.system.client.web.servlet;

import java.lang.management.ManagementFactory;
import java.rmi.registry.LocateRegistry;
import java.util.HashMap;

import javax.management.MBeanServer;
import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL;
import javax.servlet.http.HttpServlet;

/**
 * Servlet implementation class JMSServiceBridgeServlet
 */
public class JMSServiceBridgeServlet extends HttpServlet {

  static {
    try {
      LocateRegistry.createRegistry(7111);
      MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
      HashMap env = new HashMap();
      JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://localhost:7102/jndi/rmi://localhost:7111/jmxrmi");
      JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
      cs.start();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }
}
